﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Reception : System.Web.UI.Page
{
    Connectdbnour con = new Connectdbnour();
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = GlobalClass.Client;
    }
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList2.SelectedItem.ToString() == "Medical Test" || DropDownList2.SelectedItem.ToString() == "Small Surgery")
        {
            DropDownList3.Enabled = true;
            TextBox1.Enabled = true;
        }
        else if (DropDownList2.SelectedItem.ToString() == "Buying" || DropDownList2.SelectedItem.ToString() == "Reservation")
        {
            TextBox1.Enabled = false;
            DropDownList3.Enabled = false;
        }
        else
        {
            DropDownList3.Enabled = false;
            TextBox1.Enabled = true;
        }
        
        
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        GlobalClass.DT = DropDownList6.SelectedItem.ToString() + "-" + DropDownList5.SelectedItem.ToString() + "-" + DropDownList4.SelectedItem.ToString();
        if (DropDownList2.SelectedItem.ToString() == "Buying")
        {
            Response.Redirect("Selling.aspx");
        }
        else if (DropDownList2.SelectedItem.ToString() == "Reservation")
        {
            Response.Redirect("Reservation.aspx");
        }
        else if (DropDownList2.SelectedItem.ToString() == "Medical Test" || DropDownList2.SelectedItem.ToString() == "Small Surgery")
        {
            con.insertrecep(DropDownList1.SelectedItem.ToString(), GlobalClass.DT, Convert.ToInt32(Label1.Text), DropDownList2.SelectedItem.ToString(), DropDownList3.SelectedItem.ToString(), Convert.ToDouble(TextBox1.Text), 1);
        }
        else
        {
            con.insertrecep(DropDownList1.SelectedItem.ToString(), GlobalClass.DT, Convert.ToInt32(Label1.Text), DropDownList2.SelectedItem.ToString(), "", Convert.ToDouble(TextBox1.Text), 1);
        }        
    }
}